#include "counter.h"

int64_t Counter::getAndIncrease()
{
    // 使用lock_guard代替lock/unlock
    std::lock_guard<std::mutex> guard(mutex_);
    int64_t ret = value_++;
    return ret;
}

int64_t Counter::value() const
{
    std::lock_guard<std::mutex> guard(mutex_);
    return value_;
}
